# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-flake8
_pyname=flake8
pkgver=3.8.3
pkgrel=0
pkgdesc="A modular source code checker"
url="https://gitlab.com/pycqa/flake8"
arch="noarch"
license="MIT"
depends="py3-entrypoints py3-pyflakes py3-pycodestyle py3-mccabe py3-setuptools"
checkdepends="py3-pytest py3-pbr py3-atomicwrites py3-attrs py3-pluggy py3-six py3-mock"
source="https://files.pythonhosted.org/packages/source/f/flake8/flake8-$pkgver.tar.gz"
builddir="$srcdir/flake8-$pkgver"

replaces="py-flake8" # Backwards compatibility
provides="py-flake8=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	PYTHONPATH=$PWD/build/lib python3 -m pytest -v \
		--deselect=tests/integration/test_api_legacy.py::test_legacy_api \
		--deselect=tests/integration/test_main.py \
		--deselect=tests/integration/test_plugins.py \
		--deselect=tests/unit/test_setuptools_command.py::test_package_files_removes_submodules
}

package() {
	mkdir -p "$pkgdir"/usr/bin
	ln -s flake8 "$pkgdir"/usr/bin/flake8-3

	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="007158ea5caf60ff84e935f1b74a5f746fba00991c8808395ff72126dc1a8c8e135badc6f1f383027349076b8f3e146e9d0af27b6e24cdf97390463fd69ad940  flake8-3.8.3.tar.gz"
